package com.gzdh.device.system.service.impl;


import com.gzdh.device.system.dto.SysUserDetailsDTO;
import com.gzdh.device.system.dto.UserAuthInfoDTO;
import com.gzdh.device.system.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class TokenUserDetailsService implements UserDetailsService {

    @Autowired
    SysUserService sysUserService;

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {

        UserAuthInfoDTO userAuthInfoDTO = sysUserService.loadUserByUsername(s);


        return new SysUserDetailsDTO(userAuthInfoDTO);
    }
}
